<?php /*a:3:{s:61:"/www/wwwroot/douyin/application/admin/view/command/index.html";i:1712113464;s:60:"/www/wwwroot/douyin/application/admin/view/index_layout.html";i:1710484120;s:53:"/www/wwwroot/douyin/application/admin/view/layui.html";i:1712799662;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo config('site.web_name'); ?></title>
    <meta name="author" content="YZNCMS">
    <link rel="stylesheet" href="/static/libs/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/admin.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <link rel="stylesheet" href="/static/common/font/iconfont.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <script src="/static/libs/layui/layui.js"></script>
    <script src="/static/libs/jquery/jquery.min.js"></script>
    <script type="text/javascript">
    //全局变量
    var GV = {
        'site':<?php echo json_encode($site); ?>,
        'image_upload_url': '<?php echo !empty($image_upload_url) ? htmlentities($image_upload_url) :  url("admin/ajax/upload", ["dir" => "images"]); ?>',
        'file_upload_url': '<?php echo !empty($file_upload_url) ? htmlentities($file_upload_url) :  url("admin/ajax/upload", ["dir" => "files"]); ?>',
        'attachment_select_url': '<?php echo !empty($attachment_select_url) ? htmlentities($attachment_select_url) :  url("general.attachments/select"); ?>',
    };
    </script>
</head>

<body class="childrenBody <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
    
<div class="layui-card">
    <div class="layui-card-header">在线命令管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
            data-auth-execute="<?php echo $auth->check('execute'); ?>"
            data-auth-delete="<?php echo $auth->check('del'); ?>" ></table>
        </div>
    </div>
</div>
<script type="text/html" id="barTool">
    <a href='<?php echo url("execute"); ?>?ids={{ d.id }}' class="layui-btn layui-btn-xs btn-ajax <?php echo $auth->check('execute')?'':'layui-hide'; ?>">再次执行</a>
    <a data-open='<?php echo url("detail"); ?>?ids={{ d.id }}' data-title="详情" class="layui-btn layui-btn-xs layui-bg-blue <?php echo $auth->check('detail')?'':'layui-hide'; ?>"><i class="iconfont icon-zoom-in-line"></i> 详情</a>
    <a href='<?php echo url("del"); ?>?id={{ d.id }}' class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del <?php echo $auth->check('del')?'':'layui-hide'; ?>"><i class="iconfont icon-trash_fill"></i></a>
</script>

    
    <script type="text/javascript">
layui.config({
	version: '<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>',
	base: '/static/libs/layui_exts/'
}).extend({
	yzn: 'yzn/yzn',
	yznForm: 'yznForm/yznForm',
	tab: "pear/tab",               // 多选项卡组件
	yznUpload: 'yznUpload/yznUpload',
	yznTable: 'yznTable/yznTable',
	clipboard: 'clipboard/clipboard.min',
	notice: 'notice/notice.min',
	iconPicker: 'iconPicker/iconPicker.min',
	ztree: 'ztree/ztree',
	dragsort: 'dragsort/dragsort.min',
	tagsinput: 'tagsinput/tagsinput',
	xmSelect: 'xmSelect/xm-select',
	selectPage: 'selectPage/selectpage.min',
	echarts: 'echarts/echarts',
	echartsTheme: 'echarts/echartsTheme',
	citypicker: 'citypicker/city-picker',
	dropzone: 'dropzone/dropzone.min',
	ueditor: 'ueditor/ueditor.min',
	cxselect: 'cxselect/cxselect',
	addons: 'addons',
    aliossUploader:'aliossUploader'
});
</script>
    
    
<script>
layui.use(['yznTable','table'], function() {
    var yznTable = layui.yznTable;
    var table = layui.table;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: "<?php echo url('add'); ?>",
        delete_url: '<?php echo url("del"); ?>',
    };

    yznTable.render({
        init: init,
        toolbar: ['refresh','add','delete'],
        url: '<?php echo url("index"); ?>',
        search:false,
        cols: [
            [
                { type: 'checkbox', fixed: 'left' },
                { field: 'id', width: 60, title: 'ID' },
                { field: 'type',width: 80, title: '类型'},
                { field: 'type_text',width: 150, title: '类型'},
                { field: 'command', title: '命令', templet:function(d) {
                     return '<input type="text" class="layui-input" style="height:28px;" value="' + d.command + '">';
                  }
                },
                { field: 'execute_time',width: 160, title: '执行时间', search: 'range',templet: yznTable.formatter.datetime },
                { field: 'create_time', width: 160,title: '创建时间', search: 'range',templet: yznTable.formatter.datetime },
                { field: 'update_time', width: 160,title: '更新时间', search: 'range',templet: yznTable.formatter.datetime },
                { field: 'status', width: 80,title: '状态',templet: yznTable.formatter.status,selectList:{0:'失败',1:'成功'},search:false},
                { fixed: 'right', width: 190, title: '操作', toolbar: '#barTool' }
            ]
        ],
        page: {}
    });

    $(document).on('click', '.btn-ajax', function (e) {
        var url = $(this).attr("href");
        var tableId = init.table_render_id;
        yzn.request.post({
            url: url
        }, function(data,res) {
            layer.alert("<textarea class='layui-textarea' cols='60' rows='5'>" + data.result + "</textarea>", {
                title: "执行结果",
                shadeClose: true
            });
            tableId && table.reload(tableId);
        }, function(data,ret) {
            yzn.msg.error(ret.msg);
        })
        return false;
    })

    yznTable.bindevent();
});
</script>

</body>

</html>